<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="../ucs.css">
		<link rel="stylesheet" href="../font/iconfont.css">
		<link rel="stylesheet" href="../demo.css">
	</head>
	<body>
	<div id="main" ></div>
	<script type="text/javascript" src="../../dist/libs/u-eventhub.js"></script>
	<script type="text/javascript" src="../../dist/libs/engine.js" ></script>
	<script type="text/javascript" src="../../dist/ucsmy-ui.js"></script>
	<script>
		/**
		 * 个人信息：
		 * 		realNameDM:企业名称
		 * 		phoneNumDM：手机
		 * 		ownPwdDM：登录密码
		 * 	*/
		var realNameDM = new UDM({
			value: '张三'
		});
		var phoneNumDM = new UDM({
			value: '18718417732'
		});
		var ownPwdDM = new UDM({
			value:""
		});
		//个人实名信息
		var realNameInfoDM = new UDM({
			value:{
                AccType:1,
                Mobile:"155****2132",
                IsBindMobile:true,//是否绑定手机
                BindMobileUrl:"../demoUserInfo/index.html",//绑定手机链接
                IsBindIDCard:false,//是否验证身份
                BindIDCardUrl:"../demoUserInfo/index.html",//验证身份链接
                IsBindBankCard:false,//是否绑卡
                BindBankCardUrl:"../demoMyBankCard/index.html",//绑卡链接
                Current:"InvestInfo",  //当前选中菜单
                InvestAccountUrl:"../demoMyAccount11/index.html",//投资账户总览链接
                InvestListUrl:"../demoMyInvest/index.html",//投资记录链接
                MyBankCardUrl:"../demoMyBankCard/index.html",//我的银行卡链接
                InvestInfoUrl:"../demoUserInfo/index.html",//投资个人信息
                InvestMessageUrl:"../demoUserMessageCenter/index.html",//投资消息中心
                FinanceAccountUrl:"../demoFinanceAccount/index.html",//融资账户总览链接
                FinanceListUrl:"../demoFinanceList/index.html",//融资记录链接
                FinanceAccountUrl:"../demoAccountInfo/index.html",//融资账号信息
                FinanceMessageUrl:"../demoCompanyMessageCenter/index.html"//融资消息中心
			}
		})

		var loginPwdDM = new UDM({
			label: '<span>*</span>原密码：',
			placeholder:'请输入原密码',
			validator:[
				{type:"require",msg:"密码不能为空"},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"密码必须为6-16位字母、数字的组合"
				}
			]
		});
		var newPwdDM = new UDM({
			label: '<span>*</span>新密码：',
			placeholder:'请输入新密码',
			validator:[
				{type:"require",msg:"密码不能为空"},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"请输入正确的密码"
				}
			]
		});
		var newPwdDM2 = new UDM({
			label: '<span>*</span>确认新密码：',
			placeholder:'请输入新密码',
			validator:[
				{type:"require",msg:"密码不能为空"},
				{
					type:"fn",
					fn:function(v){
//						console.log(pswDM.getValue());
						if(v == newPwdDM.getValue()){
							return true;
						}else{
							return false;
						}
					},
					msg:"两次输入密码不一致"
				}
			]
		});
		var phoneCodeDM = new UDM({
			label: '<span>*</span>手机验证码：',
			placeholder:'请输入短信验证码',
			validator:[
				{type:"require",msg:"请输入短信验证码"},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"短信验证码错误，请重新输入"
				},
				{
					type:"fn",
					fn:function(v){
						if(v == 123){
							return true;
						}else{
							return false;
						}
					},
					msg:"验证码已过期，请重新获取"
				}
			]
		});


		var getBtnCode = new UDM({//修改登录密码  获取短信验证码按钮
			id:"msgbtn",
			name:"",
			count:5,
			onClick:function(){
				if(loginPwdDM.validate() && newPwdDM.validate() && newPwdDM2.validate()){
					return true;
				}else{
					return false;
				}
			}
		});

		var confirmBtnDM = new UDM({
			onClick:function(){
				console.log(realNameDM);
				if(loginPwdDM.validate() && newPwdDM.validate() && newPwdDM2.validate() && phoneCodeDM.validate()){ //校验各数据模型
					console.log('校验通过！')
					return true;
				}else{
					console.log('校验没通过！');
					return false;
				}
			}
		});

		var PageDM = {
			realName: realNameDM,
			phoneNum: phoneNumDM,
			loginPwd: loginPwdDM,
			newPwd: newPwdDM,
			newPwd2: newPwdDM2,
			phoneCode: phoneCodeDM,
			getBtnCode:getBtnCode,
			ownPwd:ownPwdDM,
			btn: confirmBtnDM,
			realNameInfo: realNameInfoDM
		}

		var ajaxFn = function(){
			/*个人实名信息*/
			var realName = {
                AccType:1,
                Mobile:"155****2132",
                IsBindMobile:true,//是否绑定手机
                BindMobileUrl:"../demoUserInfo/index.html",//绑定手机链接
                IsBindIDCard:false,//是否验证身份
                BindIDCardUrl:"../demoUserInfo/index.html",//验证身份链接
                IsBindBankCard:false,//是否绑卡
                BindBankCardUrl:"../demoMyBankCard/index.html",//绑卡链接
                Current:"FinanceAccountInfo",  //当前选中菜单
                InvestAccountUrl:"../demoMyAccount/index.html",//投资账户总览链接
                InvestListUrl:"../demoMyInvest/index.html",//投资记录链接
                MyBankCardUrl:"../demoMyBankCard/index.html",//我的银行卡链接
                InvestInfoUrl:"../demoUserInfo/index.html",//投资个人信息
                InvestMessageUrl:"../demoUserMessageCenter/index.html",//投资消息中心
                FinanceAccountUrl:"../demoFinanceAccount/index.html",//融资账户总览链接
                FinanceListUrl:"../demoFinanceList/index.html",//融资记录链接
                FinanceAccountInfoUrl:"../demoAccountInfo/index.html",//融资账号信息
                FinanceMessageUrl:"../demoCompanyMessageCenter/index.html"//融资消息中心
			};
			realNameInfoDM.setValue(realName);
		};
		UEventHub.on("pageLoad",function(){
			ajaxFn()
		});
	</script>
    </body>
</html>
